|
|
|
|
|
|
|
Set the Name property of the new control to vtxUpper, the UpperCase property to True, and the Text property to ''". Save the form as TEXT.FRM and the project as TEST.VBP and run the project. When you type in the textbox, all your input is converted to uppercase (see Figure 5.14). |
|
|
|
|
|
|
|
|
Figure 5.14.
Testing the VText control's
UpperCase option. |
|
|
|
|
|
|
|
|
Now add two more VText controls to the form. Set the Name property of one to vtxDigits, the Digits property to True, and the Text property to "". For the other control, set the name property to vtxNumeric, the Numeric property to True, and the Text property to "". You can also add three labels to the form as shown in Figure 5.15. |
|
|
|
|
|
|
|
|
Figure 5.15.
Laying out the Test form. |
|
|
|
|
|
|
|
|
After laying out the form, you can add two lines of code to the project. These lines of code display a message box each time the user presses an invalid key inside each of the VText controls. Add the code in Listing 5.22 to the project. |
|
|
|
|
|
|
|
|
Listing 5.22. Coding the error events for VText. |
|
|
|
|
|
|
|
|
Private Sub vtxDigits_DigitsError(KeyAscii As Variant)
'
MsgBox "Enter Digits only! '0123456789'"
'
End Sub |
|
|
|
|
|